from blogapp import app
from exts import mongo, loginmanager
from flask_script import Manager, Shell
from flask_pagedown import PageDown
from flask_simplemde import SimpleMDE


manager = Manager(app=app)
app.config.from_object('config')
mongo.init_app(app)
loginmanager.init_app(app)
pagedown = PageDown(app=app)
simplemde = SimpleMDE(app=app)


def make_shell_context():
    return dict(app=app, mongo=mongo)


manager.add_command('shell', Shell(make_context=make_shell_context))


if __name__ == '__main__':
    manager.run()
